/*
package cn.dglydrpy.eshop.website.learn.webflux;

import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.Date;

//控制器
@Component
public class DateTimeHandler {
    private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public Mono<ServiceResponse> getDate(ServiceRequest request){
        return ServiceResponse.ok().contentType(MediaType.TEXTPLAN).body(Mono.just(sdf.format(new Date())),String.class);
    }

    public Mono<ServiceResponse> getDateTime(ServiceRequest request){
        return ServiceResponse.ok().contentType(MediaType.TEXT_EVEN_STREAM).body(Flux.interval(Duration.of(2, ChronoUnit.SECONDS)).
                map(a -> "time is "+a).just(sdf.format(new Date())),String.class);
    }
}
*/
